var $=function(node){
return document.getElementById(node);
}
function $(objId){
return document.getElementById(objId);
}
//过滤文本左右两端的空格
function GetRequest(Url,Sendtxt,GetFunction){
if(window.ActiveXObject){
var xmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
}else{
var xmlHttpRequest = new XMLHttpRequest();
}
xmlHttpRequest.onreadystatechange = function(){
if(xmlHttpRequest.readyState == 4){
if(xmlHttpRequest.status == 200){
GetFunction(xmlHttpRequest.responseText);
}
}
}
xmlHttpRequest.open("post",Url,true);
xmlHttpRequest.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlHttpRequest.send(Sendtxt);
}
document.onkeydown = function(e){
if(!e) e = window.event;
if((e.keyCode || e.which) == 13){
document.getElementById("sub").click();
}
}
function inst() {
if ($("name")!=null && $("name").value=="") $("name").value = $("tishi1").innerHTML;
if ($("sfzh")!=null && $("sfzh").value=="") $("sfzh").value = $("tishi2").innerHTML;
if ($("es")!=null && $("es").value=="") $("es").value = $("tishi3").innerHTML;
if ($("code")!=null) $("code").value = $("tishi4").innerHTML;
}
function st(ids,Num){
if ($(ids).value == $("tishi"+Num).innerHTML){
$(ids).value = "";
}
}
function startRequest(Num) {
if(Num == 1 || Num == 0){
if($("ch").value == "" ){
$('10').style.borderColor='red';
$("al").innerHTML = "请选择自取药店网点";
return false;
}else{
SendUrl = "ajax.php?pi="+$("pici").value;
Sendtxt = "Act=ch&pi="+$("pici").value+"&ch="+$("ch").value+"&T="+Math.random();
GetRequest(SendUrl,Sendtxt,function(GetText){
if(GetText == "0"){
$('10').style.borderColor='green';
$("al").innerHTML = "";
}else{
$('10').style.borderColor='red';
$("al").innerHTML = ""+GetText;
return false;
}
});
}
}
if(Num == 2 || Num == 0){
if($("name").value == "" || $("name").value == $("tishi1").innerHTML){
$("name").value = $("tishi1").innerHTML;
$('11').style.borderColor='red';
return false;
}else{
$('11').style.borderColor='green';
}
}
if(Num == 3 || Num == 0){
if($("sfzh").value == "" || $("sfzh").value == $("tishi2").innerHTML){
$("sfzh").value = $("tishi2").innerHTML;
$('12').style.borderColor='red';
return false;
}else{
var MailReg = /^[0-9]{17,17}[0-9Xx]$/;
if(!MailReg.test($("sfzh").value)){
$('12').style.borderColor='red';
$("pk").innerHTML = "身份证号码格式错误!";
return false;
}
SendUrl = "ajax.php";
Sendtxt = "Act=sfzh&sfzh="+$("sfzh").value+"&T="+Math.random();
GetRequest(SendUrl,Sendtxt,function(GetText){
if(GetText == "0"){
$('12').style.borderColor='green';
$("pk").innerHTML = "";
}else{
$('12').style.borderColor='red';
$("pk").innerHTML = ""+GetText;
return false;
}
});
}
}
if(Num == 4 || Num == 0){
if($("es").value == "" || $("es").value == $("tishi3").innerHTML){
$("es").value = $("tishi3").innerHTML;
$('13').style.borderColor='red';
return false;
}else{
var MailReg = /^1[3456789][0-9]{9,9}$/;
if(!MailReg.test($("es").value)){
$('13').style.borderColor='red';
return false;
}else{
$('13').style.borderColor='green';
}
}
}
if(Num == "0"){
}
}
